#include <REGX52.H>
void delay_10us(unsigned int ten_us)
{
	while (--ten_us);
}
void main()
{
  unsigned	int index=0;
	P2=~0x01;
	while(1)
  {
		if(P3_1==0){
				delay_10us(2000);
				while(P3_1==0);
				delay_10us(2000);
				if(index<=0)
					index=7;
				else				
					index--;	
				P2=~(0x01<<index);		
		}	
		
		if(P3_0==0){
				delay_10us(2000);
				while(P3_0==0);
				delay_10us(2000);
						
				if(index>=7)
					index=0;	
				else 
					index++;	
				P2=~(0x01<<index);
		}	
	}
}